package com.example.itces.service.Impl;

import com.example.itces.domain.JgQuestion;
import com.example.itces.domain.Question;
import com.example.itces.mapper.QuestionMapper;
import com.example.itces.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class QuestionServiceImpl implements QuestionService {

    @Resource
    QuestionMapper questionMapper ;


    /**
     * 单选题目插入
     * @param question
     * @return
     */
    @Override
    public int insertQuestion(Question question) {
        int i = questionMapper.insertQuestion(question);
        return i ;
    }

    /**
     * 按照ID查询题目
     * @param id
     * @return
     */
    @Override
    public Question selectById(int id) {
        Question question = questionMapper.selectById(id);
        return question ;
    }


    /**
     * 随机查询JAVA单选题
     * @return
     */
    @Override
    public List<Question> getJavaQuestion(String qtype) {
        List<Question> question = questionMapper.getJavaQuestion(qtype);
        return question;
    }


    /**
     * Java判断题插入
     * @param jgQuestion
     * @return
     */
    @Override
    public int insertJgQuestion(JgQuestion jgQuestion) {

        int i = questionMapper.insertJgQuestion(jgQuestion);

        return i ;
    }

    @Override
    public List<JgQuestion> getJavaJgQuestion(String qtype) {
        List<JgQuestion> list = questionMapper.getJavaJgQuestion(qtype);
        return list;

    }


}
